<%
   no_record_message = t("views.invoices.recurring.no_record_msg")
   if params[:status] == "archived" || @action == "recovered from archived" ||  @action == "deleted from archived"
     no_record_message = t("views.invoices.recurring.no_record_msg_archived")
   elsif params[:status] == "deleted" || @action == "recovered from deleted"
     no_record_message = t("views.invoices.recurring.no_record_msg_deleted")
   end
%>
<%= hidden_field_tag :direction, params[:direction] %>
<%= hidden_field_tag :sort, params[:sort] %>
<% if  @recurring_profiles.length > 0 %>
    <% @recurring_profiles.each do |profile| %>
        <tr>
          <td class="align_center"> <%= check_box_tag "recurring_profile_ids[]", profile.id, false, :id => "recurring_profile_#{profile.id}" %></td>
          <td class="align_center"><%= link_to profile.invoice_number, recurring_profile_path(profile), :class => "invoices_link #{'deleted_entry' if profile.deleted?}" %></td>
          <td class="align_left text-overflow-class" data-overflow-rows="2" ><%= profile.client.try(:organization_name).blank??  profile.recurring_unscoped_client.try(:organization_name) : profile.client.organization_name %></td>
          <td class="align_left"><%= profile.last_sent_date.to_time.strftime(get_date_format) rescue "" %></td>
          <td class="align_center"><%= profile.frequency %></td>
          <td class="align_right"><%= "#{number_to_currency(profile.invoice_total, unit: profile.currency.present? ? profile.currency.unit : "$")}" %></td>
          <td class="align_center"><%=  profile.remaining_occurrences %></td>
          <td class="align_center">
            <% if profile.deleted_at.nil? %>
                <%= link_to t('.edit', :default => t("helpers.links.edit")),
                            edit_recurring_profile_path(profile) %>
            <% end %>
          </td>
        </tr>
    <% end %>

<% else %>
    <tr>
      <td colspan="8">
        <div class="no_record_container"><%= no_record_message %></div>
      </td>
    </tr>
<% end %>
